from music21 import converter, instrument, stream

# 解析 MIDI
midi = converter.parse("/home/goldfish/debian/dev/py/audio/get-note/O400000kinhV3motzG.ogg.mid")

# 如果有多个乐器，合并
parts = instrument.partitionByInstrument(midi)
if parts:  
    score = parts.parts[0].recurse()
else:
    score = midi.flat.notes

# 显示乐谱（会弹出 MuseScore 或 musicxml viewer）
midi.show()
